package com.docker.sys.role;

import com.docker.core.constant.MainConstant;
import com.docker.core.mvc.dao.BaseDao;
import com.jfinal.plugin.activerecord.Record;

/**
 * @Author ldl
 * @Create 2020/09/18 018 09:39
 */
public class RoleDao extends BaseDao {

    @Override
    protected String getDbName() {
        return MainConstant.DB_DOCKER;
    }

    @Override
    protected String getSqlTplNameSpace() {
        return "sys.role";
    }

    public boolean exist(String deptCode, String roleName, String roleId) {
        return tplQueryInt("exist", deptCode, roleName, roleId) > 0;
    }

    public boolean save(Record role) {
        return save("sys_role", "role_id", role);
    }

    public Record info(String roleId) {
        return info("sys_role", "role_id", roleId);
    }

    public boolean update(Record role) {
        return update("sys_role", "role_id", role);
    }

}
